import request from "@/utils/request";
import { TradeMarkResponseData,TradeMark } from "./type";
enum API{
    TRADEMARK_URL = "http://114.115.179.162:8022/prod-api/admin/product/baseTrademark/",
    ADDTRADEMARK_URL = "http://114.115.179.162:8022/prod-api/admin/product/baseTrademark/save",
    UPDATETRADEMARK_URL = "http://114.115.179.162:8022/prod-api/admin/product/baseTrademark/update",
    DELETE_URL = 'http://114.115.179.162:8022/prod-api/admin/product/baseTrademark/remove/'
}

export const reqHasTrademark = (page:number,limit:number)=>request.get<any,TradeMarkResponseData>(API.TRADEMARK_URL+`${page}/${limit}`)

export const reqAddOrUpdateTrademark = (data:TradeMark)=>{
    if(data.id){
        return request.put<any,any>(API.UPDATETRADEMARK_URL,data)
    }else{
        return request.post<any,any>(API.ADDTRADEMARK_URL,data)
    }
}
export const reqDeleteTrademark = (id:number)=>request.delete<any>(API.DELETE_URL+id)